home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 24 / AACD 24.iso / AACD / Sound / LAME / WarpOS / src / configure.in < prev    next >
Encoding:
Text File  |  2001-07-01  |  25.2 KB  |  876 lines

  1. dnl $Id: configure.in,v 1.62 2001/06/29 15:23:53 markt Exp $
  2. dnl
  3. dnl
  4. dnl don't forget to set ASM_FOR_ARCH to a space delimited list of
  5. dnl processor architectures, for which assembler routines exist
  6. dnl
  7. dnl
  8. dnl Exported and configured variables:
  9. dnl CC
  10. dnl CFLAGS
  11. dnl LDFLAGS
  12. dnl LDADD
  13. dnl NASM
  14.  
  15. dnl extra vars for frontend:
  16. dnl FRONTEND_LDFLAGS
  17. dnl FRONTEND_CFLAGS
  18. dnl FRONTEND_LDADD
  19.  
  20. AC_PREREQ(2.13)
  21. AC_INIT(libmp3lame/lame.c)
  22.  
  23. dnl check system
  24. AC_CANONICAL_SYSTEM
  25. AC_VALIDATE_CACHED_SYSTEM_TUPLE
  26.  
  27. dnl automake
  28. AM_INIT_AUTOMAKE(lame,3.89)
  29. AM_CONFIG_HEADER(config.h)
  30. AM_MAINTAINER_MODE
  31. AM_MAKE_INCLUDE
  32.  
  33. dnl libtool
  34. # AC_DISABLE_SHARED
  35. AC_PROG_LIBTOOL
  36. CFLAGS="${ac_save_CFLAGS}"
  37.  
  38. # increase this when the shared lib becomes totally incompatible
  39. LIB_MAJOR_VERSION=0
  40.  
  41. # increase this when changes are made, but they are upward compatible
  42. # to previous versions
  43. LIB_MINOR_VERSION=0
  44.  
  45. dnl check environment
  46. AC_AIX
  47. AC_ISC_POSIX
  48. AC_MINIX
  49. AC_CYGWIN
  50. AC_EXEEXT
  51.  
  52. dnl # work around for a bug, don't know where it is exactly
  53. if test "${ac_cv_cygwin}" = "yes"; then
  54.     if test "${CC}" != "gcc"; then
  55.         AC_MSG_ERROR([Please use]
  56.             [   CC=gcc ./configure]
  57.             [Abort this configure run and add "CC=gcc" or you will]
  58.             [see errors and no lame.exe will be build.])
  59.     fi
  60. fi
  61.  
  62. dnl check programs
  63. AM_PROG_CC_STDC
  64.  
  65. dnl more automake stuff
  66. AM_C_PROTOTYPES
  67.  
  68. AC_CHECK_HEADER(dmalloc.h)
  69. if test "$ac_cv_header_dmalloc_h" = "yes"; then
  70.     AM_WITH_DMALLOC
  71. fi
  72.  
  73. dnl Checks for header files.
  74. AC_HEADER_STDC
  75. AC_CHECK_HEADERS( \
  76.          errno.h \
  77.          fcntl.h \
  78.          limits.h \
  79.          string.h \
  80.          sys/soundcard.h \
  81.          sys/time.h \
  82.          unistd.h \
  83.          linux/soundcard.h)
  84.  
  85. dnl Checks for typedefs, structures, and compiler characteristics.
  86. AC_C_CONST
  87. AC_C_INLINE
  88. if test ${cross_compiling} = "no"; then
  89.     AC_C_BIGENDIAN
  90. fi
  91.  
  92. if test "${GCC}" = "yes"; then
  93.     AC_MSG_CHECKING(version of GCC)
  94.     GCC_version=`${CC} --version`
  95.     AC_MSG_RESULT(${GCC_version})
  96. fi
  97.  
  98. AC_CHECK_SIZEOF(short, 2)
  99. AC_CHECK_SIZEOF(unsigned short, 2)
  100. AC_CHECK_SIZEOF(int, 4)
  101. AC_CHECK_SIZEOF(unsigned int, 4)
  102. AC_CHECK_SIZEOF(long, 4)
  103. AC_CHECK_SIZEOF(unsigned long, 4)
  104. AC_CHECK_SIZEOF(long long, 8)
  105. AC_CHECK_SIZEOF(unsigned long long, 8)
  106. AC_CHECK_SIZEOF(float, 4)
  107. AC_CHECK_SIZEOF(double, 8)
  108.  
  109. if test ${cross_compiling} = "no"; then
  110.     AC_C_LONG_DOUBLE
  111. fi
  112. if test "${ac_cv_c_have_long_double}" = "yes" ; then
  113.     AC_CHECK_SIZEOF(long double, 12)
  114. fi
  115.  
  116. AC_CHECK_TYPE(uint8_t, unsigned char)
  117. AC_CHECK_TYPE(int8_t, char)
  118. AC_CHECK_TYPE(uint16_t, unsigned short)
  119. AC_CHECK_TYPE(int16_t, short)
  120. if test "${ac_cv_sizeof_int}" = "4" ; then
  121.     AC_CHECK_TYPE(uint32_t, unsigned int)
  122.     AC_CHECK_TYPE(int32_t, int)
  123. elif test "${ac_cv_sizeof_long}" = "4" ; then
  124.     AC_CHECK_TYPE(uint32_t, unsigned long)
  125.     AC_CHECK_TYPE(int32_t, long)
  126. else
  127.     # can't determine default value in case the type isn't present
  128.     AC_MSG_ERROR(CHECK_TYPE_int32_t - please report to lame-dev@lists.sourceforge.net)
  129. fi
  130. if test "${ac_cv_sizeof_long}" = "8" ; then
  131.     AC_CHECK_TYPE(uint64_t, unsigned long)
  132.     AC_CHECK_TYPE(int64_t, long)
  133. elif test "${ac_cv_sizeof_long_long}" = "8" ; then
  134.     AC_CHECK_TYPE(uint64_t, unsigned long long)
  135.     AC_CHECK_TYPE(int64_t, long long)
  136. else
  137.     # can't determine default value in case the type isn't present
  138.     AC_MSG_ERROR(CHECK_TYPE_int64_t - please report to lame-dev@lists.sourceforge.net)
  139. fi
  140.  
  141. alex_IEEE854_FLOAT80
  142. if test "${alex_cv_ieee854_float80}" = "yes" ; then
  143.     if test "${ac_cv_c_long_double}" = "yes" ; then
  144.         AC_CHECK_TYPE(ieee854_float80_t, long double)
  145.         AC_DEFINE(HAVE_IEEE854_FLOAT80, 1, [system has 80 bit floats])
  146.     fi
  147. fi
  148. AC_CHECK_TYPE(ieee754_float64_t, double)
  149. AC_CHECK_TYPE(ieee754_float32_t, float)
  150.  
  151. AC_DEFINE(LAME_LIBRARY_BUILD, 1, [requested by Frank, seems to be temporary needed for a smooth transition])
  152.  
  153.  
  154. if test ${cross_compiling} = "yes"; then
  155.     AC_MSG_WARN([]
  156.   [**************************************************************************]
  157.   [*                                                                        *]
  158.   [* You are cross compiling:                                               *]
  159.   [*   - I did not have a change to determine                               *]
  160.   [*     + the size of:                                                     *]
  161.   [*       - short                                                          *]
  162.   [*       - unsigned short                                                 *]
  163.   [*       - int                                                            *]
  164.   [*       - unsigned int                                                   *]
  165.   [*       - long                                                           *]
  166.   [*       - unsigned long                                                  *]
  167.   [*       - float                                                          *]
  168.   [*       - double                                                         *]
  169.   [*       - long double                                                    *]
  170.   [*     + the endianess of the target system                               *]
  171.   [*   - You have to provide appropriate defines for them in config.h, e.g. *]
  172.   [*     + define SIZEOF_SHORT to 2 if the size of a short is 2             *]
  173.   [*     + define WORDS_BIGENDIAN if your system is a big endian system     *]
  174.   [*                                                                        *]
  175.   [**************************************************************************])
  176. fi
  177.  
  178. AC_TYPE_SIZE_T
  179. AC_HEADER_TIME
  180.  
  181. dnl Checks for library functions.
  182. AC_FUNC_ALLOCA
  183. AC_CHECK_FUNCS(gettimeofday socket strtol)
  184.  
  185.  
  186. dnl Initialize configuration variables for the Makefile
  187. CFLAGS=${CFLAGS}
  188. CONFIG_DEFS=${CONFIG_DEFS}
  189. NASM=
  190. INCLUDES="-I\$(top_srcdir)/include -I\$(srcdir)"
  191. FRONTEND_LDFLAGS=
  192. FRONTEND_CFLAGS=
  193. LIB_SOURCES=
  194. MAKEDEP="-M"
  195. RM_F="rm -f"
  196.  
  197. AC_ARG_ENABLE(nasm,
  198.   [  --enable-nasm              Allow the use of nasm if available],
  199.   ASM_FOR_ARCH="i386", ASM_FOR_ARCH="")
  200.  
  201. dnl Checks for libraries.
  202.  
  203. AC_CHECK_HEADERS(termcap.h)
  204. AC_CHECK_HEADERS(ncurses/termcap.h)
  205. AC_CHECK_LIB(termcap, initscr, HAVE_TERMCAP="termcap")
  206. AC_CHECK_LIB(curses, initscr, HAVE_TERMCAP="curses")
  207. AC_CHECK_LIB(ncurses, initscr, HAVE_TERMCAP="ncurses")
  208.  
  209. dnl math lib
  210. AC_CHECK_LIB(m, cos, USE_LIBM="-lm")
  211. dnl free fast math library
  212. AC_CHECK_LIB(ffm, cos, USE_LIBM="-lffm")
  213. dnl Compaq fast math library.
  214. AC_CHECK_LIB(cpml, cos, USE_LIBM="-lcpml")
  215. CONFIG_MATH_LIB="${USE_LIBM}"
  216.  
  217. AC_CHECK_LIB(sndfile, sf_open_read, HAVE_SNDFILE="yes")
  218.  
  219.  
  220. dnl configure use of features
  221.  
  222. AM_PATH_GTK(1.2.0, HAVE_GTK="yes", HAVE_GTK="no")
  223. if test "${HAVE_GTK}" = "yes"; then
  224.     AC_DEFINE(HAVE_GTK, 1, have working GTK)
  225. fi
  226.  
  227.  
  228. dnl ElectricFence malloc debugging
  229. AC_MSG_CHECKING(use of ElectricFence malloc debugging)
  230. AC_ARG_ENABLE(efence,
  231.   [  --enable-efence            Use ElectricFence for malloc debugging],
  232.   CONFIG_EFENCE="${enableval}", CONFIG_EFENCE="no")
  233.  
  234. case "${CONFIG_EFENCE}" in
  235. yes)
  236.     AC_CHECK_LIB(efence, EF_Print, HAVE_EFENCE="-lefence")
  237.     if test "x${HAVE_EFENCE}" != "x-lefence"; then
  238.         AC_MSG_RESULT(yes, but libefence not found)
  239.     else
  240.         LDADD="${LDADD} ${HAVE_EFENCE}"
  241.         AC_DEFINE(HAVE_EFENCE, 1, we link against libefence)
  242.         AC_MSG_RESULT("${CONFIG_EFENCE}")
  243.     fi
  244.     ;;
  245. no)
  246.     AC_MSG_RESULT("${CONFIG_EFENCE}")
  247.     ;;
  248. *)
  249.     AC_MSG_ERROR(bad value »${CONFIG_EFENCE}« for efence option)
  250.     ;;
  251. esac
  252.  
  253.  
  254. dnl libsndfile
  255. AC_MSG_CHECKING(use of file io)
  256. WARNING=
  257. AC_ARG_WITH(fileio, 
  258.   [  --with-fileio=lame         Use lame's internal file io routines [default]]
  259.   [             =sndfile      Use Erik de Castro Lopo's libsndfile]
  260.   [                           (no stdin possible currently)],
  261.   CONFIG_FILEIO="${withval}", CONFIG_FILEIO="lame")
  262. AC_ARG_WITH(sndfile-prefix,
  263.   [  --with-sndfile-prefix=DIR  Alternate location for libsndfile],
  264.   CONFIG_SNDFILE_PREFIX="${withval}", CONFIG_SNDFILE_PREFIX="")
  265. if test "${CONFIG_FILEIO}" = "sndfile" ; then
  266.   if test "x${CONFIG_SNDFILE_PREFIX}" != "x" ; then 
  267.     # look for sndfile lib. This overrides any standard location
  268.     LA_SEARCH_LIB(SNDFILE_LIB_LOC, SNDFILE_INC_LOC, \
  269.       libsndfile.a, sndfile.h, $CONFIG_SNDFILE_PREFIX) 
  270.     if test "x${SNDFILE_LIB_LOC}" != "x" ; then
  271.       HAVE_SNDFILE="yes"
  272.       FRONTEND_LDFLAGS="-L${SNDFILE_LIB_LOC} ${FRONTEND_LDFLAGS}"
  273.       INCLUDES="-I${SNDFILE_INC_LOC} ${INCLUDES}"
  274.     else
  275.       WARNING="sndfile lib not found in specified prefix."
  276.     fi
  277.   fi
  278.   if test "${HAVE_SNDFILE}" = "yes" ; then
  279.     FRONTEND_LDADD="-lsndfile ${FRONTEND_LDADD}"
  280.     AC_DEFINE(LIBSNDFILE, 1, build with libsndfile support)
  281.   else
  282.     # default
  283.     CONFIG_FILEIO="lame"
  284.     WARNING="${WARNING} Could not find any sndfile lib on system."
  285.   fi
  286. else
  287.   CONFIG_FILEIO="lame"
  288. fi 
  289. AC_MSG_RESULT(${CONFIG_FILEIO})
  290. if test "x${WARNING}" != "x" ; then
  291.   AC_MSG_WARN($WARNING)
  292. fi
  293.  
  294.  
  295. dnl check if we should remove hooks for analyzer code in library
  296. dnl default library must include these hooks
  297. AC_MSG_CHECKING(use of analyzer hooks)
  298. AC_ARG_ENABLE(analyzer-hooks,
  299.   [  --disable-analyzer-hooks   Exclude analyzer hooks],
  300.   CONFIG_ANALYZER="${enableval}", CONFIG_ANALYZER="yes")
  301.  
  302. case "${CONFIG_ANALYZER}" in
  303. yes)
  304.     ;;
  305. no)
  306.     AC_DEFINE(NOANALYSIS, 1, build without hooks for analyzer)
  307.     ;;
  308. *)
  309.     AC_MSG_ERROR(bad value »${CONFIG_ANALYZER}« for analyzer-hooks option)
  310.     ;;
  311. esac
  312. AC_MSG_RESULT($CONFIG_ANALYZER)
  313.  
  314.  
  315. dnl mpg123 decoder
  316. AC_MSG_CHECKING(use of mpg123 decoder)
  317. AC_ARG_ENABLE(decoder, 
  318.   [  --disable-decoder          Exclude mpg123 decoder],
  319.   CONFIG_DECODER="${enableval}", CONFIG_DECODER="yes")
  320. AC_ARG_ENABLE(decode-layer1, 
  321.   [  --disable-decoder-layer1   Exclude layer1 decoding],
  322.   CONFIG_DECODER_L1="${enableval}", CONFIG_DECODER_L1="yes")
  323. AC_ARG_ENABLE(decode-layer1, 
  324.   [  --disable-decoder-layer2   Exclude layer2 decoding],
  325.   CONFIG_DECODER_L2="${enableval}", CONFIG_DECODER_L2="yes")
  326.  
  327. AM_CONDITIONAL(LIB_WITH_DECODER, test "x${CONFIG_DECODER}" = "xyes")
  328.  
  329. if test "${CONFIG_DECODER}" != "no" ; then
  330.     CONFIG_DECODER="yes (Layer"
  331.     AC_DEFINE(HAVE_MPGLIB, 1, build with mpglib support)
  332.   
  333.     if test "${CONFIG_DECODER_L1}" != "no"; then
  334.         CONFIG_DECODER="${CONFIG_DECODER} 1,"
  335.         AC_DEFINE(USE_LAYER_1, 1, build with layer 1 decoding)
  336.     fi
  337.     if test "${CONFIG_DECODER_L2}" != "no"; then
  338.         CONFIG_DECODER="${CONFIG_DECODER} 2,"
  339.         AC_DEFINE(USE_LAYER_2, 1, build with layer 2 decoding)
  340.     fi
  341.     CONFIG_DECODER="${CONFIG_DECODER} 3)"
  342. fi
  343. AC_MSG_RESULT($CONFIG_DECODER)
  344.  
  345.  
  346. dnl vorbis
  347. WARNING=
  348. AC_ARG_WITH(vorbis, 
  349.   [  --with-vorbis              Use vorbis library for ogg files]
  350.   [                           [default: no]],
  351.   CONFIG_VORBIS="${withval}", CONFIG_VORBIS="no")
  352. AC_ARG_WITH(vorbis-prefix,
  353.   [  --with-vorbis-prefix=DIR   Alternate location for vorbis],
  354.   CONFIG_VORBIS_PREFIX="${withval}", CONFIG_VORBIS_PREFIX="")
  355. if test "${CONFIG_VORBIS}" != "no" ; then
  356.   if test "x${CONFIG_VORBIS_PREFIX}" != "x" ; then
  357.     # look for vorbis lib. This overrides any standard location
  358.     LA_SEARCH_LIB(VORBIS_LIB_LOC, VORBIS_INC_LOC, \
  359.       libvorbis.a, vorbis/codec.h, ${CONFIG_VORBIS_PREFIX})
  360.     if test "x${VORBIS_LIB_LOC}" != "x" ; then
  361.       HAVE_VORBIS="yes"
  362.       FRONTEND_LDFLAGS="-L${VORBIS_LIB_LOC} ${FRONTEND_LDFLAGS}"
  363.       INCLUDES="-I${VORBIS_INC_LOC} ${INCLUDES}"
  364.     else
  365.       WARNING="vorbis lib not found in specified prefix."
  366.     fi
  367.   fi
  368.  
  369.   AC_CHECK_LIB(vorbis, ogg_sync_init, HAVE_VORBIS="yes")
  370.  
  371.   if test "${HAVE_VORBIS}" = "yes" ; then
  372.     FRONTEND_LDFLAGS="-lvorbis ${FRONTEND_LDFLAGS}"
  373.     AC_DEFINE(HAVE_VORBIS, 1, build with vorbis support)
  374.   else
  375.     CONFIG_VORBIS="no"
  376.   fi
  377. fi
  378. AC_MSG_CHECKING(use of vorbis)
  379. AC_MSG_RESULT(${CONFIG_VORBIS})
  380. if test "x${WARNING}" != "x" ; then
  381.   AC_MSG_WARN($WARNING)
  382. fi
  383.  
  384.  
  385.  
  386. AC_MSG_CHECKING(if mp3x is requested)
  387. AC_ARG_ENABLE(mp3x,
  388.   [  --enable-mp3x              Build GTK frame analyzer [default: no]],
  389.     WITH_MP3X="mp3x", WITH_MP3X=)
  390. if test "x${WITH_MP3X}" = "xmp3x"; then
  391.     AC_MSG_RESULT(yes)
  392. else
  393.     AC_MSG_RESULT(no)
  394. fi
  395.  
  396. if test "${HAVE_GTK}" = "no"; then
  397.     if test "x${WITH_MP3X}" = "xmp3x"; then
  398.         AC_MSG_WARN(can't build mp3x, no GTK installed)
  399.         WITH_MP3X=
  400.     fi
  401.     if test "x${CONFIG_ANALYZER}" != "xyes"; then
  402.         AC_MSG_WARN(can't build mp3x because of disabled analyzer hooks)
  403.         WITH_MP3X=
  404.     fi
  405. fi
  406.  
  407. AC_MSG_CHECKING(if mp3rtp is requested)
  408. AC_ARG_ENABLE(mp3rtp,
  409.   [  --enable-mp3rtp            Build mp3rtp [default: no]],
  410.     WITH_MP3RTP="mp3rtp", WITH_MP3RTP=)
  411. if test "x${WITH_MP3RTP}" = "xmp3rtp"; then
  412.     AC_MSG_RESULT(yes)
  413. else
  414.     AC_MSG_RESULT(no)
  415. fi
  416.  
  417.  
  418. #
  419. # this is from vorbis
  420. #
  421. dnl check GLIBC
  422. case $target in 
  423. *86-*-linux*)
  424.     # glibc < 2.1.3 has a serious FP bug in the math inline header
  425.     # that will cripple Vorbis.  Look to see if the magic FP stack
  426.     # clobber is missing in the mathinline header, thus indicating
  427.     # the buggy version
  428.  
  429.     AC_EGREP_CPP(log10.*fldlg2.*fxch,[
  430.         #define __LIBC_INTERNAL_MATH_INLINES 1
  431.              #define __OPTIMIZE__
  432.         #include <math.h>
  433.         ],bad=maybe,bad=no)
  434.  
  435.     AC_MSG_CHECKING(glibc mathinline bug)
  436.     if test ${bad} = "maybe" ;then
  437.           AC_EGREP_CPP(log10.*fldlg2.*fxch.*st\([[0123456789]]*\),
  438.                 [
  439.                 #define __LIBC_INTERNAL_MATH_INLINES 1
  440.                      #define __OPTIMIZE__
  441.                 #include <math.h>
  442.                 ],bad=no,bad=yes)
  443.     fi
  444.     AC_MSG_RESULT(${bad})
  445.     if test ${bad} = "yes" ;then
  446.  AC_MSG_WARN([                                                        ])
  447.  AC_MSG_WARN([********************************************************])
  448.  AC_MSG_WARN([* The glibc headers on this machine have a serious bug *])
  449.  AC_MSG_WARN([* in /usr/include/bits/mathinline.h  This bug affects  *])
  450.  AC_MSG_WARN([* all floating point code, not only LAME, but all code *])
  451.  AC_MSG_WARN([* built on this machine. Upgrading to glibc 2.1.3 is   *])
  452.  AC_MSG_WARN([* strongly urged to correct the problem.               *])
  453.  AC_MSG_WARN([*Note: that upgrading glibc will not fix any previously*])
  454.  AC_MSG_WARN([* built programs; this is a compile-time bug.          *])
  455.  AC_MSG_WARN([* To work around the problem for this build of LAME,   *])
  456.  AC_MSG_WARN([* autoconf is disabling all math inlining.  This will  *])
  457.  AC_MSG_WARN([* hurt LAME performace but is necessary for LAME to    *])
  458.  AC_MSG_WARN([* work correctly.  Once glibc is upgraded, rerun       *])
  459.  AC_MSG_WARN([* configure and make to build with inlining.           *])
  460.  AC_MSG_WARN([********************************************************])
  461.  AC_MSG_WARN([                                                        ])
  462.  
  463.     AC_DEFINE(__NO_MATH_INLINES, 1, work around a glibc bug)
  464.     fi;;
  465. esac
  466.  
  467.  
  468. dnl configure use of VBR bitrate histogram
  469. dnl todo: always use yes as default, use simulation instead ?
  470. AC_MSG_CHECKING(use of VBR bitrate histogram)
  471. if test "x${HAVE_TERMCAP}" != "x"; then
  472.   BRH_DEFAULT="yes"
  473. else
  474.   BRH_DEFAULT="no"
  475. fi
  476. AC_ARG_ENABLE(brhist, 
  477.   [  --enable-brhist            Include the VBR bitrate histogram feature]
  478.   [                           [default: yes if any termcap available]],
  479.   CONFIG_BRHIST="${enableval}", CONFIG_BRHIST="${BRH_DEFAULT}")
  480. if test "${CONFIG_BRHIST}" != "no" ; then
  481.     AC_DEFINE(BRHIST, 1, enable VBR bitrate histogram)
  482.  
  483.     if test "${BRH_DEFAULT}" = "yes" ; then
  484.         FRONTEND_LDADD="-l${HAVE_TERMCAP} ${FRONTEND_LDADD}"
  485.         CONFIG_BRHIST="yes, with ${HAVE_TERMCAP}"
  486.         AC_DEFINE(HAVE_TERMCAP, 1, have termcap)
  487.     else
  488.         CONFIG_BRHIST="yes, simulated termcap"
  489.     fi
  490. fi
  491. AC_MSG_RESULT(${CONFIG_BRHIST})
  492. AM_CONDITIONAL(WITH_BRHIST, test "${CONFIG_BRHIST}" != "no")
  493.  
  494.  
  495.  
  496. dnl ### processor specific options ###
  497. case $target_cpu in
  498. *86)
  499.     CPUTYPE="i386"
  500.  
  501.     # this may make a faster binary
  502.     AC_DEFINE(TAKEHIRO_IEEE754_HACK, 1, IEEE754 compatible machine)
  503.     ;;
  504. *)
  505.     CPUTYPE="no"
  506.     ;;
  507. esac
  508.  
  509.  
  510.  
  511. AC_MSG_CHECKING(for FLOAT8 as float)
  512. AC_ARG_ENABLE(all-float,
  513.   [  --enable-all-float         Whether to make all floting point variables as float, not double]
  514.   [                           [default: no]],   
  515.     CONFIG_ALLFLOAT="${enableval}", CONFIG_ALLFLOAT="no")
  516. case "${CONFIG_ALLFLOAT}" in
  517. no)
  518.     ;;
  519. yes)
  520.     AC_DEFINE(FLOAT8, float, float instead of double)
  521.     ;;
  522. *)
  523.     AC_MSG_ERROR(bad value »${CONFIG_ALLFLOAT}« for all-float option)
  524.     ;;
  525. esac
  526. AC_MSG_RESULT(${CONFIG_ALLFLOAT})
  527.  
  528.  
  529.  
  530. AC_PATH_PROG(NASM, nasm, no)
  531. case "${NASM}" in
  532. no)
  533.     ;;
  534. *)
  535.     AC_MSG_CHECKING(for assembler routines for this processor type)
  536.     for recurse_over in ${ASM_FOR_ARCH}
  537.     do
  538.         if test "${CPUTYPE}" = "${recurse_over}"; then
  539.             include_asm_routines="yes"
  540.         fi
  541.     done
  542.     if test "x${include_asm_routines}" = "xyes"; then
  543.         AC_DEFINE(HAVE_NASM, 1, have nasm)
  544.         AC_DEFINE(MMX_choose_table, 1, use MMX version of choose_table)
  545.     else
  546.         include_asm_routines="no"
  547.         NASM="no"
  548.     fi
  549.     AC_MSG_RESULT(${include_asm_routines})
  550.     ;;
  551. esac
  552. AM_CONDITIONAL(HAVE_NASM, test "${NASM}" != "no")
  553.  
  554. if test "x$CYGWIN" = "xyes"; then
  555.     NASM_FORMAT="-f win32 -DWIN32"
  556. else
  557.     NASM_FORMAT="-f elf"
  558. fi
  559.  
  560. AC_MSG_CHECKING(for additional optimizations)
  561. AC_ARG_ENABLE(expopt,
  562.   [  --enable-expopt=full,norm  Whether to enable experimental optimizations]
  563.   [                           [default: no]],   
  564.     CONFIG_EXPOPT="${enableval}", CONFIG_EXPOPT="no")
  565.  
  566. if test "x$GCC" = "xyes"; then
  567.     # gcc defaults. OS specific options go in versious sections below
  568.         # from the gcc man pages:  "there is no reason to use -pedantic"
  569.     CFLAGS="-Wall -pipe ${CFLAGS}"
  570.  
  571.     OPTIMIZATION="-O3 -fomit-frame-pointer -ffast-math -funroll-loops"
  572.  
  573.     OPTIMIZATION_NORM="-fthread-jumps -malign-double -frerun-loop-opt \
  574.         -fgcse -fexpensive-optimizations"
  575.  
  576.     OPTIMIZATION_FULL="-fmove-all-movables -fschedule-insns2 \
  577.         -freduce-all-givs"
  578.  
  579.     case "${CONFIG_EXPOPT}" in
  580.     no)
  581.         ;;
  582.     norm|yes)
  583.         OPTIMIZATION="${OPTIMIZATION} ${OPTIMIZATION_NORM}"
  584.         ;;
  585.     full)
  586.         OPTIMIZATION="${OPTIMIZATION} ${OPTIMIZATION_NORM} \
  587.             ${OPTIMIZATION_FULL}"
  588.  
  589.         # some hardware dependend options
  590.         case "${GCC_version}" in
  591.         2.9*|3.*)
  592.             # "new" GCC, use some "new" CPU specific optimizations
  593.             case ${target_cpu} in
  594.             *486)
  595.                 OPTIMIZATION="${OPTIMIZATION} -m486 \
  596.                     -mfancy-math-387"
  597.                 ;;
  598.             *586)
  599.                 OPTIMIZATION="${OPTIMIZATION} -mpentium \
  600.                     -march=pentium -mfancy-math-387"
  601.                 ;;
  602.             *686)
  603.                 OPTIMIZATION="${OPTIMIZATION} -mpentiumpro \
  604.                     -march=pentiumpro -mfancy-math-387"
  605.                 ;;
  606.             *86)
  607.                 OPTIMIZATION="${OPTIMIZATION} -mfancy-math-387"
  608.                 ;;
  609.             alpha*)
  610.                 OPTIMIZATION="${OPTIMIZATION} -mfp-regs"
  611.                 AC_DEFINE(FLOAT, double, double is faster than float on Alpha)
  612.                 # add "-mcpu=21164a -Wa,-m21164a" to optimize
  613.                 # for 21164a (ev56) CPU
  614.                 ;;
  615.             *)
  616.                 OPTIMIZATION="${OPTIMIZATION} -fdelayed-branch"
  617.                 ;;
  618.             esac
  619.         ;;
  620.     *)
  621.         AC_MSG_ERROR(bad value »${CONFIG_EXPOPT}« for expopt option)
  622.         ;;
  623.     esac
  624. esac
  625.  
  626.     AC_MSG_RESULT(${CONFIG_EXPOPT})
  627. else
  628.     AC_MSG_RESULT(no)
  629. fi
  630.  
  631.  
  632.  
  633.  
  634.  
  635. AC_MSG_CHECKING(for debug options)
  636. AC_ARG_ENABLE(debug,
  637.   [  --enable-debug=alot,norm   Enable debugging (disables optimizations)]
  638.   [                           [default: no]],
  639.     CONFIG_DEBUG="${enableval}", CONFIG_DEBUG="no")
  640.  
  641. if test "x$GCC" = "xyes"; then
  642.     DEBUG_NORM_OPT="-O -g -Wall"
  643.     DEBUG_ANOYING="-Wbad-function-cast -Wcast-align \
  644.         -Wcast-qual -Wchar-subscripts -Wconversion \
  645.         -Wmissing-prototypes -Wnested-externs -Wpointer-arith \
  646.         -Wredundant-decls -Wshadow -Wstrict-prototypes \
  647.         -Wwrite-strings -Winline \
  648.         -Wformat -Wswitch -Waggregate-return -Wmissing-noreturn \
  649.         -Wimplicit-int -fno-builtin"
  650.  
  651.     case "${CONFIG_DEBUG}" in
  652.     no)
  653.         AC_DEFINE(NDEBUG, 1, no debug build)
  654.         ;;
  655.     norm|yes)
  656.         AC_DEFINE(ABORTFP, 1, debug define)
  657.         OPTIMIZATION="${DEBUG_NORM_OPT}"
  658.         ;;
  659.     anoying)
  660.         AC_DEFINE(ABORTFP, 1, debug define)
  661.         OPTIMIZATION="${DEBUG_NORM_OPT} ${DEBUG_ANOYING}"
  662.         ;;
  663.     alot)
  664.         AC_DEFINE(ABORTFP, 1, debug define)
  665.         AC_DEFINE(DEBUG, 1, alot of debug output)
  666.         OPTIMIZATION="${DEBUG_NORM_OPT}"
  667.         ;;
  668.     *)
  669.         AC_MSG_ERROR(bad value »${CONFIG_DEBUG}« for debug option)
  670.     esac
  671.  
  672.     AC_MSG_RESULT(${CONFIG_DEBUG})
  673. else
  674.     AC_MSG_RESULT(no)
  675. fi
  676.  
  677.  
  678.  
  679. dnl ###  system specific options  ###
  680.  
  681. ##########################################################################
  682. # LINUX on Digital/Compaq Alpha CPUs
  683. ##########################################################################
  684. case $target in
  685. alpha*-*-linux*)
  686.  
  687. ################################################################
  688. #### Check if 'ccc' is in our path
  689. ################################################################
  690. if test "`which ccc 2>/dev/null | grep -c ccc`" != "0" ; then
  691.     # Compaq's C Compiler
  692.     CC=ccc
  693.  
  694. ################################################################
  695. #### set 'OPTIMIZATION = -arch host -tune host' 
  696. ####              to generate/tune instructions for this machine
  697. ####     'OPTIMIZATION += -migrate -fast -inline speed -unroll 0' 
  698. ####              tweak to run as fast as possible :)
  699. ####     'OPTIMIZATION += -w0' 
  700. ####              set warning and linking flags
  701. ################################################################
  702.     OPTIMIZATION="-arch host -tune host"
  703.     OPTIMIZATION="-migrate -fast -inline speed -unroll 0 $OPTIMIZATION"
  704.     OPTIMIZATION="-w0 $OPTIMIZATION"
  705.  
  706.  
  707. ################################################################
  708. #### to debug, uncomment
  709. ################################################################
  710.     # For Debugging
  711.     #OPTIMIZATION="-g3 $OPTIMIZATION"
  712.  
  713. ################################################################
  714. #### define __DECALPHA__ (i was getting re-declaration warnings
  715. ####   in machine.h
  716. ################################################################
  717.     # Define DEC Alpha
  718.     AC_DEFINE(__DECALPHA__, 1, we're on DEC Alpha)
  719. fi  #  gcc or ccc?
  720. ;; # alpha
  721.  
  722.  
  723. ##########################################################################
  724. # SunOS
  725. ##########################################################################
  726. sparc-*-sunos4*)
  727.     CC="cc"
  728.     OPTIMIZATION="-O -xCC"
  729.     MAKEDEP="-xM"
  730.     # for gcc, use instead:
  731.     #   CC="gcc"
  732.     #   OPTIMIZATION="-O"
  733.     #   MAKEDEP="-M"
  734.     endif
  735. ;; #SunOS
  736.  
  737. ##########################################################################
  738. # SGI
  739. ##########################################################################
  740. *-sgi-irix*)
  741.     CC="cc"
  742.     OPTIMIZATION="-O3 -woff all"
  743. ;; # SGI
  744.  
  745. ##########################################################################
  746. # Compaq Alpha running Dec Unix (OSF)
  747. ##########################################################################
  748. alpha*-dec-osf*)
  749.     CC = cc
  750.     OPTIMIZATION="-fast -O3 -std -g3 -non_shared"
  751. ;; #OSF
  752.  
  753. ##########################################################################
  754. # BeOS
  755. ##########################################################################
  756. *-*-beos*) # todo:is this the right string ?
  757.     CC="\$(BE_C_COMPILER)"
  758.     case $target in
  759.     bepc*-*-*) # todo: is this right architecture ? was: if ($(ARCH),BePC)
  760.        OPTIMIZATION="-O9 -fomit-frame-pointer -march=pentium \
  761.             -mcpu=pentium -ffast-math -funroll-loops \
  762.             -fprofile-arcs -fbranch-probabilities"
  763.     ;;
  764.        *) OPTIMIZATION="-opt all"
  765.        MAKEDEP="-make"
  766.     ;;
  767.     esac
  768. ;; #BeOS
  769. esac
  770.  
  771. # todo: include the following tests in the case-list
  772. UNAME=`uname`
  773. ARCH=`uname -m`
  774.  
  775. ###########################################################################
  776. # MOSXS (Rhapsody PPC)
  777. ###########################################################################
  778. if test "$UNAME" = "Rhapsody"; then
  779. #   CC="cc"   # should be handled already by autoconf
  780.    MAKEDEP="-make"
  781. fi
  782.  
  783. ##########################################################################
  784. # OS/2
  785. ##########################################################################
  786. # Properly installed EMX runtime & development package is a prerequisite.
  787. # tools I used: make 3.76.1, uname 1.12, sed 2.05, PD-ksh 5.2.13
  788. #
  789. ##########################################################################
  790. if test "$UNAME" = "OS/2"; then
  791.    SHELL=sh
  792.    #CC=gcc # should already be handled by configure
  793.  
  794.    # file extension should already be handled by automake (I don't know,
  795.    # please  give feedback!
  796.    #FILE_EXTENSION=".exe"
  797.  
  798. # Uncomment & inspect the GTK lines to use MP3x GTK frame analyzer.
  799. # Properly installed XFree86/devlibs & GTK+ is a prerequisite.
  800. # The following works for me using Xfree86/OS2 3.3.5 and GTK+ 1.2.3:
  801. #   AC_DEFINE(HAVE_GTK, 1, have GTK)
  802. #   AC_DEFINE(__ST_MT_ERRNO__, 1)
  803. #   INCLUDES="-IC:/XFree86/include/gtk12 -IC:/XFree86/include/glib12 \
  804. #             -IC:/XFree86/include $INCLUDES"
  805. #   FRONTEND_LDFLAGS="-LC:/XFree86/lib -lgtk12 -lgdk12 -lgmodule -lglib12 \
  806. #             -lXext -lX11 -lshm -lbsd -lsocket -lm $FRONTEND_LDFLAGS"
  807. #   FRONTEND_CFLAGS="-Zmtd -Zsysv-signals -Zbin-files $FRONTEND_CFLAGS"
  808. fi
  809.  
  810. ###########################################################################
  811. # MSDOS/Windows
  812. ###########################################################################
  813. if test "$UNAME" = "MSDOS"; then
  814.   # file extension should alredy be handled by automake (I don't know, please
  815.   # give feedback!
  816.   #FILE_EXTENSION=".exe"
  817.   RM_F=
  818. fi
  819.  
  820. ###########################################################################
  821. # AmigaOS
  822. ###########################################################################
  823. # Type 'Make ARCH=PPC' for PowerUP and 'Make ARCH=WOS' for WarpOS
  824. #
  825. ###########################################################################
  826. if test "$UNAME" = "AmigaOS" ; then
  827.     CC="gcc -noixemul"
  828.     OPTIMIZATION=$OPTIMIZATION -m68020-60 -m68881
  829.     MAKEDEP="-MM"
  830.     if test "$ARCH" = "WOS"; then
  831.         CC="ppc-amigaos-gcc -warpup"
  832.         OPTIMIZATION=$OPTIMIZATION -mmultiple -mcpu=603e"
  833.         AR="ppc-amigaos-ar"
  834.         RANLIB="ppc-amigaos-ranlib"
  835.     fi
  836.     if test "$ARCH",PPC; then
  837.         CC="ppc-amigaos-gcc"
  838.         OPTIMIZATION=$OPTIMIZATION -mmultiple -mcpu=603e"
  839.         AR="ppc-amigaos-ar"
  840.         RANLIB="ppc-amigaos-ranlib"
  841.     fi
  842. fi
  843.  
  844.  
  845. CFLAGS="${OPTIMIZATION} ${CFLAGS}"
  846. LDADD="${CONFIG_MATH_LIB} ${LDADD}"
  847.  
  848.  
  849.  
  850. AC_SUBST(INCLUDES)
  851.  
  852. AC_SUBST(FRONTEND_LDFLAGS)
  853. AC_SUBST(FRONTEND_CFLAGS)
  854. AC_SUBST(FRONTEND_LDADD)
  855. AC_SUBST(LDADD)
  856.  
  857. AC_SUBST(LIB_MAJOR_VERSION)
  858. AC_SUBST(LIB_MINOR_VERSION)
  859.  
  860. AC_SUBST(NASM)
  861. AC_SUBST(NASM_FORMAT)
  862.  
  863. AC_SUBST(MAKEDEP)
  864. AC_SUBST(RM_F)
  865.  
  866. AC_SUBST(LIBTOOL_DEPS)
  867.  
  868. AC_SUBST(WITH_MP3X)
  869. AC_SUBST(WITH_MP3RTP)
  870.  
  871. AC_SUBST(CPUTYPE)
  872.  
  873. AC_SUBST(CONFIG_DEFS)
  874.  
  875. AC_OUTPUT(Makefile libmp3lame/Makefile libmp3lame/i386/Makefile frontend/Makefile mpglib/Makefile doc/Makefile doc/html/Makefile doc/man/Makefile include/Makefile Dll/Makefile misc/Makefile debian/Makefile dshow/Makefile lame.spec)
  876.